package com.ssm.service;
import com.ssm.dao.testDao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.domain.Module;

/**
 * 事务的拦截应该统一在service层，特别注意，在该层中不要捕获任何异常，全部向外抛，这样事务才能回滚
 * @author MyComputer
 * //这样回滚
public Test getBean(Test bean) throws Except~~~~ion{
         testMapper.insert(bean);
         System.err.println(1/0);
         return bean;
    }
//这样不回滚
public Test saveBean(Test bean) throws Exception {
        testMapper.insert(bean);
        try {
            System.err.println(1 / 0);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return bean;
    }
//回滚
    public Test saveBean(Test bean) throws Exception {
        testMapper.insert(bean);
        try {
            System.err.println(1 / 0);
        } catch (Exception e1) {
            throw new Exception(e1);
        }
        return bean;
    }
 *
 */
@Service
public class testServiceImpl implements testService {

	@Autowired
	private testDao testDao;
	
	@Override
	public List<Module> findModle() {
		System.out.println("service");
		return testDao.findAll();
	}

}
